﻿using S_Userinfor.Domains;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace S_UserInfor.Infrasturctre
{
    public  class SqlSugarInfor
    {
        public readonly ISqlSugarClient _db;

        public SqlSugarInfor(ISqlSugarClient db)
        {
            _db = db;
        }

        public void CreateTable()
        {
            //没有数据库则创建
            _db.DbMaintenance.CreateDatabase();
            //以codefirst的模式字符串长度为50的备份表
            _db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
            {
                typeof(User),  //用户
            });

        }
    }
}
